<?php
class My_Message
{
    protected static $_flashMessenger;

    protected function _getFlashMessenger()
    {
        if (!self::$_flashMessenger) {
            self::$_flashMessenger = Zend_Controller_Action_HelperBroker::getStaticHelper('FlashMessenger');
        }
        return self::$_flashMessenger;
    }

    public static function addError($message = '')
    {
        self::_getFlashMessenger()->setNameSpace('error')->addMessage($message);
    }

    public static function addSuccess($message = '')
    {
        self::_getFlashMessenger()->setNameSpace('success')->addMessage($message);
    }
}